package com.xidian.zhiancloud.service.luling.systemconfiguration;

import com.xidian.zhiancloud.controller.luling.systemconfiguration.LevelStatus;
import com.xidian.zhiancloud.dao.ControlLevelStatusMapper;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.exception.CustomizeException;
import com.xidian.zhiancloud.model.ControlLevelStatus;
import com.xidian.zhiancloud.model.ControlLevelStatusExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 管控层级
 */
@Service

public class LevelStatusService {
@Autowired
private ControlLevelStatusMapper controlLevelStatusMapper;
    public void update(LevelStatus levelStatus) {
        ControlLevelStatusExample example = new ControlLevelStatusExample();
        ControlLevelStatusExample.Criteria criteria = example.createCriteria();
        criteria.andIdEqualTo(levelStatus.getId());
        ControlLevelStatus levelStatus1 = new ControlLevelStatus();
        levelStatus1.setCompanyId(levelStatus.getCompanyId());
        levelStatus1.setLevelColor(levelStatus.getLevelColor());
        levelStatus1.setLevelSys(levelStatus.getLevelSys());
        levelStatus1.setNeed(levelStatus.getNeed());
        int count = controlLevelStatusMapper.updateByExampleSelective(levelStatus1, example);
        if (count == 0) {
            throw new CustomizeException(GeneralResponseEnums.SYSTEM_ERROR);
        }
    }
}